<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <title>仓库报表-发货统计</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="styles/bootstrap.min.css">
    <link rel="stylesheet" href="styles/app.css">
</head>

<body>
    <div class="container" style="height:100%;width:100%">
        <div id="title" class="row">
            发货统计
        </div>
        <div class="row" style="height:90vh;width:100%">
            <div id="main" class="col-md-4 report">
            </div>
            <div id="main1" class="col-md-4 report"></div>
            <div id="main2" class="col-md-4 report"></div>
        </div>
    </div>
    <script type="text/javascript" src="scripts/libs/zepto/zepto.min.js"></script>
    <script type="text/javascript" src="scripts/libs/echarts/echarts.min.js"></script>
    <script type="text/javascript" src="scripts/libs/echarts/theme/iscs-theme.js"></script>
    <script>
        var deliveryReport = echarts.init(document.getElementById('main'), 'iscs');
        var deliveryReport1 = echarts.init(document.getElementById('main1'), 'iscs');
        var deliveryReport2 = echarts.init(document.getElementById('main2'), 'iscs');

        var option = {
            title: {
                text: '2016-09-27 发货统计',
                subtext: '总包裹数',
                subtextStyle:{
                    color:'red',
                    fontSize:'15'
                },
                x: 'center'
            },
            tooltip: {
                trigger: 'item',
                formatter: "{a} <br/>{b} : {c} ({d}%)"
            },
            series: [{
                name: '单数',
                type: 'pie',
                radius: '50%',
                center: ['50%', '45%'],
                data: [],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }]
        };

         var option1 = {
            title: {
                text: '2016-09-27 发货统计',
                subtext: '总包裹数',
                subtextStyle:{
                    color:'red',
                    fontSize:'15'
                },
                x: 'center'
            },
            tooltip: {
                trigger: 'item',
                formatter: "{a} <br/>{b} : {c} ({d}%)"
            },
            series: [{
                name: '单数',
                type: 'pie',
                radius: '50%',
                center: ['50%', '45%'],
                data: [],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }]
        };

          var option2 = {
            title: {
                text: '2016-09-27 发货统计',
                subtext: '总包裹数',
                subtextStyle:{
                    color:'red',
                    fontSize:'15'
                },
                x: 'center'
            },
            tooltip: {
                trigger: 'item',
                formatter: "{a} <br/>{b} : {c} ({d}%)"
            },
            series: [{
                name: '单数',
                type: 'pie',
                radius: '50%',
                center: ['50%', '45%'],
                data: [],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }]
        };

        var getReportData= function (){
        $.ajax({
            //url:'http://192.168.200.138:8001/DmCamara.asmx/GetDeliveryReportJson',
            url:'data/DeliveryReport.json',
            type:'get',
            dataType:'json',
            success : function(data){
                 var DeliveryReportJson=data.DeliveryReportJson;
                 for(var key in DeliveryReportJson){
                     var data=[];
                     var obj=DeliveryReportJson[key];
                     data.push({name:'完成数('+(obj.HANDOVER_NUM/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.HANDOVER_NUM});
                     data.push({name:'等待处理('+(obj.WaitDealWith/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.WaitDealWith});
                     data.push({name:'等待波次作业('+(obj.WaitWaveWork/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.WaitWaveWork});
                     data.push({name:'拣选完成('+(obj.PickingFinish/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.PickingFinish});
                     data.push({name:'包装完成('+(obj.PackageOver/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.PackageOver});
                     data.push({name:'终捡完成('+(obj.FinalFinish/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.FinalFinish});
                     data.push({name:'下料完成('+(obj.UnloadFinish/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.UnloadFinish});
                     data.push({name:'交接完成('+(obj.HandoverFinish/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.HandoverFinish});
                     data.push({name:'锁定('+(obj.PackageLock/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.PackageLock});
                     data.push({name:'异常('+(obj.PackageError/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.PackageError});
                     data.push({name:'拣选缺货('+(obj.OutOfStock/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.OutOfStock});
                     data.push({name:'作废('+(obj.PackageInvalid/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.PackageInvalid});
                     data.push({name:'等待打印('+(obj.WaitPrint/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.WaitPrint});
                     data.push({name:'未分配拣选区('+(obj.NoPickingArea/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.NoPickingArea});
                     data.push({name:'作废待返库('+(obj.InvalidWaitPicking/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.InvalidWaitPicking});
                     data.push({name:'打印完成('+(obj.Print/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.Print});
                     data.push({name:'正在拣选('+(obj.Picking/obj.PACKAGENUM*100).toFixed(2)+'%)',value:obj.Picking});
                     if(key==0){
                        option.title.subtext='总包裹数:'+obj.PACKAGENUM;
                        option.title.text=obj.CREATE_DATE.substring(0,10);
                        option.series[0].data=data;
                        deliveryReport.setOption(option);
                     }else if(key==1){
                        option1.title.subtext='总包裹数:'+obj.PACKAGENUM;
                        option1.title.text=obj.CREATE_DATE.substring(0,10);
                        option1.series[0].data=data;
                        deliveryReport1.setOption(option1);
                     }else if(key==2){
                         option2.title.subtext='总包裹数:'+obj.PACKAGENUM;
                         option2.title.text=obj.CREATE_DATE.substring(0,10);
                         option2.series[0].data=data;
                         deliveryReport2.setOption(option2);
                     }
                 }
            }
        });
        }

        getReportData();

        setInterval(getReportData, 1000*60*2); //定时刷新

    </script>
</body>

</html>